package com.lzj.demo.base;

import java.util.Scanner;

public class CalendarTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年");
        int y = sc.nextInt();
        System.out.println("请输入月");
        int m = sc.nextInt();
        System.out.println("请输入日");
        int d = sc.nextInt();
        if (m < 0 || m > 12) {
            System.out.println("您输入的年月日有误");
            return;
        }
        if (d < 0 || d > 31) {
            System.out.println("您输入的年月日有误");
            return;
        }
        if(m==1||m==2){
            m+=12;
            y--;
        }
        int week ;
        week = (d + 2*m + 3*(m+1)/5 + y + y/4-y/100+y/400)%7;
        switch (week) {

            case 6:
                System.out.println("您输入的年月日是星期星期日");
                break;
            case 5:
                System.out.println("您输入的年月日是星期星期六");
                break;
            case 4:
                System.out.println("您输入的年月日是星期星期五");
                break;
            case 3:
                System.out.println("您输入的年月日是星期星期四");
                break;
            case 2:
                System.out.println("您输入的年月日是星期星期三");
                break;
            case 1:
                System.out.println("您输入的年月日是星期星期二");
                break;
            case 0:
                System.out.println("您输入的年月日是星期星期一");
                break;
        }

    }
}


